package org.andengine.ui.activity;

import org.andengine.engine.Engine;
import org.andengine.engine.options.EngineOptions;
import org.andengine.entity.scene.Scene;

import java.io.IOException;


/**
 * This class exists to provide exact backward naming compatibility to older versions of {@link org.andengine.ui.activity.BaseGameActivity}.
 * Please consider actually switching to the new {@link org.andengine.ui.activity.BaseGameActivity}.
 * <p/>
 * (c) 2010 Nicolas Gramlich
 * (c) 2011 Zynga Inc.
 *
 * @author Nicolas Gramlich
 * @since 11:27:06 - 08.03.2010
 */
@Deprecated
public abstract class LegacyBaseGameActivity extends BaseGameActivity {
    // ===========================================================
    // Constants
    // ===========================================================

    // ===========================================================
    // Fields
    // ===========================================================

    // ===========================================================
    // Constructors
    // ===========================================================

    // ===========================================================
    // Getter & Setter
    // ===========================================================

    // ===========================================================
    // Methods for/from SuperClass/Interfaces
    // ===========================================================

    protected abstract Engine onLoadEngine();

    protected abstract void onLoadResources();

    protected abstract void onUnloadResources();

    protected abstract Scene onLoadScene();

    protected abstract Scene onLoadComplete();

    @Override
    public final EngineOptions onCreateEngineOptions() {
        return null;
    }

    @Override
    public final Engine onCreateEngine(final EngineOptions pEngineOptions) {
        return this.onLoadEngine();
    }

    @Override
    public final void onCreateResources(final OnCreateResourcesCallback pOnCreateResourcesCallback) throws IOException {
        this.onLoadResources();

        pOnCreateResourcesCallback.onCreateResourcesFinished();
    }

    @Override
    public final void onCreateScene(final OnCreateSceneCallback pOnCreateSceneCallback) throws IOException {
        final Scene scene = this.onLoadScene();

        pOnCreateSceneCallback.onCreateSceneFinished(scene);
    }

    @Override
    public final void onPopulateScene(final Scene pScene, final OnPopulateSceneCallback pOnPopulateSceneCallback) throws IOException {
        pOnPopulateSceneCallback.onPopulateSceneFinished();
    }

    @Override
    public final void onDestroyResources() throws IOException {
        super.onDestroyResources();

        this.onUnloadResources();
    }

    @Override
    public synchronized void onGameCreated() {
        super.onGameCreated();

        this.onLoadComplete();
    }

    // ===========================================================
    // Methods
    // ===========================================================

    // ===========================================================
    // Inner and Anonymous Classes
    // ===========================================================
}
